<template>
	<view>
		<view style="height: 18upx;"></view>
		<view v-if="entity.messageId" class="card-view">
			<view class="title-text">{{entity.title}}</view>
			<view class="time-text">{{dateFormat(entity.createTimes, 'YYYY年MM月DD日 HH:mm')}}</view>
			<view class="desc-text">
				<rich-text :nodes="entity.content"></rich-text>
			</view>
		</view>
		<Empty v-else></Empty>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				messageId: '',
				entity: {
					"messageId": "",
					"title": "",
					"content": "",
					"readFlag": "",
					"createTimes": ""
				}
			}
		},
		onLoad(options) {
			this.messageId = options.messageId
			this.getRequestDetail()
		},
		methods: {
			async getRequestDetail() {
				uni.$util.showLoading()
				const res = await uni.$api.getMessageDetail(this.messageId).finally(uni.finally)
				this.entity = res.data
			},
		}
	}
</script>

<style scoped lang="scss">
	.card-view {
		width: 707rpx;
		background: #FFFFFF;
		border-radius: 14rpx;
		margin: 0 auto;
		padding: 25upx 29upx;
		position: relative;

		.title-text {
			width: 100%;
			font-size: 33rpx;
			font-family: PingFangSC, PingFang SC;
			font-weight: 600;
			color: #2C1101;
		}

		.time-text {
			width: 100%;
			padding-bottom: 25upx;
			border-bottom: 1px solid #F7E8E4;
			margin-bottom: 24upx;
			font-size: 25rpx;
			font-family: PingFangSC, PingFang SC;
			font-weight: 400;
			color: #B8ACA3;
		}

		.desc-text {
			font-size: 29rpx;
			font-family: PingFangSC, PingFang SC;
			font-weight: 400;
			color: #2C1101;
		}
	}
</style>